<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var rg = /^[a-zA-Z0-9_-]{6,12}$/;
        console.log(rg.test('q1471729313')); //true

        var rg1 = /^(abc){6,12}$/;
        console.log(rg1.test('abcabcabcabcabcabc'));
    </script>
</body>

</html>